package com.aiyige.page.my.order.model;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xiachao on 2017/11/23.
 */

public class ScreenEntity {
    public static final String THREE_DAY = "threeday";//三天内
    public static final String ONE_WEEK = "oneweek";//三天内
    public static final String TWO_WEEK = "twoweek";//两周内
    public static final String ONE_MONTH = "onemonth";//一个月内
    public static final String TWO_MONTH = "twomonth";//两个月内

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public List<SubjectSelection> getTypes() {
        if (types == null) {
            types = new ArrayList<>();
        }
        return types;
    }

    public void setTypes(List<SubjectSelection> types) {
        this.types = types;
    }

    String time = "";

    List<SubjectSelection> types;

    public void addType(SubjectSelection type) {
        if (types == null) {
            types = new ArrayList<>();
        }
        types.add(type);
    }

    /**
     * 删除类型
     * @param type
     */
    public void deleteType(SubjectSelection type) {
        if (types != null && !types.isEmpty()) {
            for (int i=0;i<types.size();i++) {
                if (types.get(i).getSubject().equals(type.getSubject())) {
                    types.remove(i);
                    break;
                }
            }
        }
    }

    public void reset() {
        if (types != null) {
            types.clear();
        }
        time = "";
    }

}
